<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta name="author" content="小袁同学,1971788445@qq.com,广州新华学院">
  <meta name="Keywords" content="小袁博客,小袁Java学习站,小袁Java学习平台,文章,博客,小袁博客,article,blog">
  <meta name="description" content="小袁博客,小袁Java学习站,小袁Java学习平台,文章,博客,小袁博客,article,blog,分享Java相关的知识和经验以及各大框架的项目开发提供Java学习的圈子">
  <meta http-equiv="content-Type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
  <link rel="shortcut icon" href="/static/img/favicon.ico">
  <!-- 基础样式库 -->
  <link rel="stylesheet" href="/static/css/bootstrap.css"/>
  <link rel="stylesheet" href="/static/css/font-awesome.css"/>
  <link rel="stylesheet" href="/static/css/animate.css"/>
  <!-- hplus样式库 -->
  <link rel="stylesheet" href="/static/css/hplus.css"/>
  <!-- 公共样式 -->
  <link rel="stylesheet" href="/static/css/customer/common.css"/>
  <!-- 自定义图标库 -->
  <link rel="stylesheet" type="text/css" href="/static/css/xy-iconfont.css"/>
  <!-- 页脚样式 -->
  <link rel="stylesheet" href="/static/css/customer/footer&cbl.css"/>
  <!-- 导航栏样式 -->
  <link rel="stylesheet" href="/static/css/customer/header.css"/>
  <!-- 侧边信息样式 -->
  <link rel="stylesheet" href="/static/css/sideBar/sidebar.css"/>
  <script type="text/javascript" src="/static/js/jquery-1.11.3.js"></script>
  <script type="text/javascript" src="/static/js/bootstrap.js"></script>
  <!-- 模板 -->
  <script type="text/javascript" src="/static/js/customer/template.js"></script>
  <!-- 音乐播放器样式 -->
  <link rel="stylesheet" href="/static/css/customer/player.min.css"/>
  <!-- 音乐播放器JS -->
  <script type="text/javascript" src="/static/js/customer/player.min.js"></script>
  <!-- element ui -->
  <link rel="stylesheet" href="/static/css/element-ui.css">
  <!-- 开发环境版本，包含了有帮助的命令行警告 -->
  <script src="/static/js/vue.js"></script>
  <script src="/static/js/element-ui.js"></script>
  <script src="/static/js/httpVueLoader.js"></script>
  <!-- 本页样式 -->
  <link rel="stylesheet" href="/static/css/customer/classify.css"/>
  <title>小袁博客</title>
  <style>
    /* 分页样式 */
    .el-pagination__jump {
      color: #55aaff;
      font-weight: bold;
    }
  </style>
</head>
<body>
<div id="main" v-cloak>
  <!-- 导航栏 -->
  <xy-navbar ref="xyNavbar" :user-info="userInfo"></xy-navbar>
  <!-- 导航栏 -->

  <!-- 中间内容 -->
  <div class="gray-bg top-navigation">
    <div id="wrapper">
      <div id="page-wrapper" class="classify_bg">
        <div class="wrapper wrapper-content">
          <div class="container-fluid">
            <div class="col-lg-8 col-md-8 col-xs-12 no-padding opacity-9">
              <div class="col-md-4 no-padding">
                <div class="panel panel-info">
                  <div class="panel-heading">
                    <i class="fa fa-bars"></i> 专栏
                  </div>
                  <div class="p-xs">
                    <ul class="domtree">
                      <!-- 父级分类 -->
                      <li v-for="(item, index) in categoryList" :key="index">
                        <span class="parent" @click="categoryHandle(item.id)">{{ item.name }}</span>
                        <span class="count">{{ item.count }} 篇</span>
                        <!-- 子分类 -->
                        <ul v-for="(item1, index1) in item.children" :key="index1">
                          <li>
                            <span class="son" @click="categoryHandle(item1.id)">{{ item1.name }}</span>
                            <span class="count">{{ item1.count }} 篇</span>
                          </li>
                        </ul>
                      </li>
                    </ul>
                  </div>
                </div>
              </div>
              <div class="col-md-8 white-bg">
                <div class="hr-line-dashed" style="background-color: #000000;"></div>
                <div class="article-list" v-for="(item, index) in articleList" :key="index">
                  <div style="cursor:pointer;" @click="browseArticleDetail(item.number)">
                    <h4>{{ item.title }}</h4>
                    <div class="digest">
                      <p>{{ item.digest }}</p>
                    </div>
                  </div>
                  <div class="footer-info">
                    <span><i class="xy-icon xyicon-clock"></i> {{ item.publishTime }}</span>
                    <span><i class="xy-icon xyicon-eyes"></i> {{ item.viewCount }}</span>
<!--                    <span><i class="xy-icon xyicon-comment"></i> {{ item.commentCount }}</span>-->
                  </div>
                  <div class="hr-line-dashed" style="background-color: #000000;"></div>
                </div>

                <!-- 分页 -->
                <div class="block" style="text-align:center;margin: 10px 0px;">
                  <el-pagination background
                                 @current-change="handleCurrentChange"
                                 :hide-on-single-page="true"
                                 :current-page.sync="pageParam.pageIndex"
                                 :page-size="pageParam.pageSize"
                                 :total="pageParam.totalCount" layout="prev, pager, next, jumper">
                  </el-pagination>
                </div>
              </div>
            </div>
            <div class="col-lg-4 col-md-4 hidden-xs hidden-sm">
              <!-- 个人资料 -->
              <div class="col-md-12 m-b-md" th:insert="common/commonSidebar::side-personal"></div>
              <!-- 个人资料 -->

              <!-- 搜索 -->
              <div class="col-md-12 m-b-sm padding-l-r-60 opacity-8" th:insert="common/commonSidebar::side-search">

              </div>
              <!-- 搜索 -->

              <!-- 热门文章 -->
              <div class="col-md-12 side-hot padding-l-r-60 opacity-8" th:insert="common/commonSidebar::side-hot"></div>
              <!-- 热门文章 -->

              <!-- 文章档案 -->
              <div class="col-md-12 side-archive padding-l-r-60 opacity-8"
                   th:insert="common/commonSidebar::side-archive"></div>
              <!-- 文章档案 -->

              <!-- 最新文章 -->
              <div class="col-md-12 side-new padding-l-r-60 opacity-8" th:insert="common/commonSidebar::side-new"></div>
              <!-- 最新文章 -->
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- 中间内容 -->

  <!-- 提交建议和问题反馈 -->
  <xy-feedback ref="xyFeedback"></xy-feedback>

  <!-- 页脚 -->
  <div th:insert="common/common::footer"></div>
  <!-- 页脚 -->

  <!-- 右侧工具 -->
  <div th:insert="common/common::right-toolbar"></div>
  <!-- 右侧工具 -->
</div>

<!-- 音乐播放器 -->
<div id="player"></div>
<!-- 引入歌曲列表和配置信息 -->
<script type="text/javascript" src="/static/js/customer/music.js"></script>
<!-- hplus的JS -->
<script type="javascript" src="/static/js/content.min.js"></script>
<!-- Axios -->
<script src="/static/js/axios.min.js"></script>
<script type="module">
  import userOperation from "../../static/js/common/navbar/userOperation.js";
  import classify from "../../static/js/api/classify.js";
  import article from "../../static/js/api/article.js";
  import feedback from "../../static/js/common/dialog/feedback.js";

  // 使用httpVueLoader
  Vue.use(httpVueLoader);

  var app = new Vue({
    el: '#main',
    components: {
      'xy-navbar': 'url:/static/component/navbar/index.vue',
      'xy-feedback': 'url:/static/component/dialog/feedback.vue'
    },
    data() {
      return {
        userInfo: {},
        // 分类
        categoryList: [],
        categoryId: 1,
        // 文章列表
        articleList: [],
        // 分页
        pageParam: {
          pageIndex: 1,
          pageSize: 10,
          totalCount: 0
        }
      }
    },
    methods: {
      // 打开问题反馈框
      openProblemDialog() {},
      // 打开提交建议框
      openSuggestDialog() {},
      // 提交问题反馈
      submitProblemFeedback() {},
      // 提交建议反馈
      submitSuggestFeedback() {},
      // 获取用户数据
      getUserInfo() {},
      // 退出登录
      logout() {},
      // 修改个人信息
      submitEditPersonal() {},
      // 找回密码
      submitFindPassword() {},
      // 修改密码
      submitEditPassword() {},
      // 发送验证码
      sendEmailCode() {},
      // 修改邮箱
      submitEditEmail(){},
      // 发送短信验证码
      sendMobileCode(){},
      // 提交修改号码
      submitEditMobileNumber(){},
      // 切页
      handleCurrentChange(val) {
        this.pageParam.pageIndex = val;
        this.findCategoryArticleList()
      },
      //  查询分类列表
      findCategoryList() {
        classify.findCategoryList().then(res => {
          this.categoryList = res.data.categoryList
        })
      },
      // 查询分类文章列表
      findCategoryArticleList() {
        article.findCategoryArticleList(this.pageParam, this.categoryId).then(res => {
          if (res) {
            let data = res.data.articleList;
            this.articleList = data.list;
            this.pageParam.totalCount = data.totalCount;
          }
        })
      },
      // 点击分类查询文章列表
      categoryHandle(id) {
        this.categoryId = id;
        this.findCategoryArticleList();
      },
      // 浏览详细文章
      browseArticleDetail(number) {
        window.location.href = '/home/article/detail/' + number
      },
    },
    beforeMount() {
      // 初始化数据
      this.findCategoryList();
      this.findCategoryArticleList()
    },
    created() {
      // 函数覆盖
      this.openProblemDialog = feedback.openProblemDialog();
      this.openSuggestDialog = feedback.openSuggestDialog();
      this.submitProblemFeedback = feedback.submitProblemFeedback();
      this.submitSuggestFeedback = feedback.submitSuggestFeedback();
      // 顶部个人相关方法
      this.getUserInfo = userOperation.getUserInfo();
      this.getUserInfo();
      this.logout = userOperation.logout();
      this.submitEditPersonal = userOperation.submitEditPersonal();
      this.submitFindPassword = userOperation.submitFindPassword();
      this.submitEditPassword = userOperation.submitEditPassword();
      this.sendEmailCode = userOperation.sendEmailCode();
      this.submitEditEmail = userOperation.submitEditEmail();
      this.sendSmsCode = userOperation.sendSmsCode();
      this.submitEditMobileNumber = userOperation.submitEditMobileNumber();
    }
  })
</script>
</body>
</html>
